package GUI;

import javax.swing.*;
import java.awt.*;

public class Text2 extends JFrame {
    private LoginPanel loginPanel = new LoginPanel(this);
    private MenuPanel menuPanel = new MenuPanel(this);
    private TernoutPanle ternoutPanle=new TernoutPanle(this);
    private Image bgimg = Util.getImage("/img/background.jpg");
    private Image imageIcon=Util.getImage("/img/icon.png");
    private CardLayout cardLayout = new CardLayout();

    public Text2() {
        this.setContentPane(new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(bgimg, 0, 0, 800, 600, this);
            }
        });
        this.setLayout(cardLayout);
        this.setIconImage(imageIcon);
        this.add("login", loginPanel);
        this.add("menu", menuPanel);
        this.add("turn",ternoutPanle);
        this.setSize(800, 600);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
    }

    public void switchPanel(String name) {
        cardLayout.show(this.getContentPane(), name);
    }

    public static void main(String[] args) {
        new Text2();
    }
}
